package com.gx.spring.event.springevent.event;

import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Service;

/**
 * Created by GX on 2017/9/12.
 */
@Service // <1>
public class EmailService implements ApplicationListener<UserRegisterEvent> { // <2>
    @Override
    public void onApplicationEvent(UserRegisterEvent userRegisterEvent) {
        System.out.println("邮件服务接到通知，给 " + userRegisterEvent.getSource() + " 发送邮件...");// <3>
        System.out.println("邮件服务接到通知，给 " + userRegisterEvent.getTimestamp() + " 发送邮件...");// <3>

    }
}
